﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Muccu.JavaScript
{
    internal class MinifyingTextWriter:TextWriter
    {
        private TextWriter output;
        private JavaScriptMinifier minifier = new JavaScriptMinifier();

        public MinifyingTextWriter(TextWriter writer)
        {
            output = writer;
        }

        public override void Write(string value)
        {
            output.Write(minifier.MinifyString(value));
        }

        public override Encoding Encoding
        {
            get { return output.Encoding; }
        }
    }
}
